package com.jinyang.jetpackdemo.util

import java.text.SimpleDateFormat
import java.util.*


/**
 * @Author:         LiuJinYang
 * @CreateDate:     2021/12/2
 * @Description:
 */
class ABC {
}

fun ABC.print(msg: String): String {
    log(msg)
    return msg + "bbb"
}

fun String.print() {
    log(this)
}

fun log(msg: Any?) =
    LjyLogUtil.d("${SimpleDateFormat("HH:mm:ss:SSS").format(Date(System.currentTimeMillis()))} [${Thread.currentThread().name}] $msg")

fun main() {
    ABC().print("aaa")
}
fun max(a: Int, b: Int)  = if(a > b)  a else b
/*
//扩展函数反编译成java的代码：
//原理：就是用static来实现，将扩展的类作为第一个参数传入即可
public final class ABC {
}
// AAKt.java
public final class AAKt {
   @NotNull
   public static final String print(@NotNull ABC $this$print, @NotNull String msg) {
      Intrinsics.checkNotNullParameter($this$print, "$this$print");
      Intrinsics.checkNotNullParameter(msg, "msg");
      log(msg);
      return msg + "bbb";
   }

   public static final void print(@NotNull String $this$print) {
      Intrinsics.checkNotNullParameter($this$print, "$this$print");
      log($this$print);
   }

   public static final void log(@Nullable Object msg) {
      StringBuilder var10000 = (new StringBuilder()).append((new SimpleDateFormat("HH:mm:ss:SSS")).format(new Date(System.currentTimeMillis()))).append(" [");
      Thread var10001 = Thread.currentThread();
      Intrinsics.checkNotNullExpressionValue(var10001, "Thread.currentThread()");
      LjyLogUtil.d((CharSequence)var10000.append(var10001.getName()).append("] ").append(msg).toString());
   }
   public static final int max(int a, int b) {
      return a > b ? a : b;
   }

   public static final void main() {
      print(new ABC(), "aaa");
   }

   // $FF: synthetic method
   public static void main(String[] var0) {
      main();
   }
}

* */